package com.boyicloud.exchangeserver.web.controller

import com.boyicloud.exchangeserver.common.Result
import org.springframework.web.bind.annotation.ControllerAdvice
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.ResponseBody
import kotlin.NoSuchElementException

@ControllerAdvice
class GlobalExceptionHandler {

    @ResponseBody
    @ExceptionHandler(NoSuchElementException::class)
    fun noSuchElementException(): Result<String> {
        return Result(success = false, data = "", errMessage = "设备已断开连接，请刷新列表后重试")
    }
}